import React from 'react';
import { CopyToClipboard } from 'react-copy-to-clipboard';
import { Toast } from 'antd-mobile';
// import { openWXapp } from '../../../service/wxConfig';

class CopyAndOpen extends React.Component<Props, State>{
    constructor(props) {
        super(props)
    }
    handleCopy = () => { 
        Toast.success('复制成功', 1, undefined, false); 
      //  openWXapp()

        this.props.onCopy && this.props.onCopy()
    }
    render() {
        const { text } = this.props;

        return (
            <CopyToClipboard
                text={text}
                onCopy={this.handleCopy}
            >
                {this.props.children}
            </CopyToClipboard>
        )
    }
}

export default CopyAndOpen